package com.jspgou.core.dao.impl;

import org.hibernate.Criteria;
import org.springframework.stereotype.Repository;

import com.jspgou.common.hibernate3.HibernateBaseDao;
import com.jspgou.common.page.Pagination;
import com.jspgou.core.dao.ZoneDao;
import com.jspgou.core.entity.Zone;

@Repository
public class ZoneDaoImpl extends HibernateBaseDao<Zone, Long>
         implements ZoneDao{
    public Pagination getAllPage(int pageNo, int pageSize) {
        Criteria crit = createCriteria();
        Pagination pagination = findByCriteria(crit, pageNo, pageSize);
        return pagination;
    }

    public Zone findById(Long id){
        Zone entity = get(id);
        return entity;
    }

    public Zone save(Zone bean){
        getSession().save(bean);
        return bean;
    }

    public Zone deleteById(Long id){
        Zone entity = super.get(id);
        if(entity != null){
            getSession().delete(entity);
        }
        return entity;
    }
    
	@Override
	protected Class<Zone> getEntityClass() {
		return Zone.class;
	}
}
